package club.banyuan.hrms.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DbUtil {

    private static String driver = PropUtil.getProp("jdbc.driver");
    private static String url = PropUtil.getProp("jdbc.url");
    private static String username = PropUtil.getProp("jdbc.username");
    private static String password = PropUtil.getProp("jdbc.password");

    static {
        try {
            // 注册驱动
            Class.forName(driver);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(url, username, password);
    }
}
